﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows;

namespace SharpSoft.WPF
{
    public static class WindowExtensions
    {
        ///// <summary>
        ///// 使窗体在指定的显示器中呈现
        ///// </summary>
        ///// <param name="win"></param>
        ///// <param name="screenIndex"></param>
        ///// <param name="max"></param>
        //public static void DisplayIn(this Window win, int screenIndex, bool max)
        //{
        //    var ss = System.Windows.Forms.Screen.AllScreens;
        //    if (screenIndex < 0 || screenIndex >= ss.Length)
        //    {
        //        throw new Exception("screenIndex out of range.");
        //    }
        //    var s = ss[screenIndex];
        //    if (!win.IsLoaded)
        //    {
        //        win.WindowStartupLocation = WindowStartupLocation.Manual;
        //    }
        //    win.Left = s.Bounds.Left;
        //    win.Top = s.Bounds.Top;
        //    win.Width = s.Bounds.Width;
        //    win.Height = s.Bounds.Height;
        //    if (max)
        //    {
        //        if (win.IsLoaded)
        //        {
        //            win.WindowState = WindowState.Maximized;
        //        }
        //        else
        //        {
        //            win.Loaded += (object sender, RoutedEventArgs e) =>
        //            {
        //                win.WindowState = WindowState.Maximized;
        //            };
        //        }
        //    }
        //}

    }
}
